package com.camel.ftp.server;

import org.apache.camel.CamelContext;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.log4j.PropertyConfigurator;

public class FTPCamel {

	public static void main(String[] args) throws Exception {

		// 日志
		PropertyConfigurator.configure("./conf/log4j.properties");
		PropertyConfigurator.configureAndWatch("./conf/log4j.properties", 1000);

		CamelContext context = new DefaultCamelContext();

		// 启动route
		context.start();

		// 将我们编排的一个完整消息路由过程，加入到上下文中

		// 本地文件上传至FTP服务器
		context.addRoutes(new LocalToFTPRouteBuilder());

		// 从FTP服务器上下载文件至本地.
		context.addRoutes(new FTPToLocalRouteBuilder());

		synchronized (FTPCamel.class) {
			FTPCamel.class.wait();
		}

	}

}
